package com.example.book_subscribe.login.mapper;

import com.example.book_subscribe.bookList.dto.BookListDto;
import com.example.book_subscribe.login.dto.UserDto;
import org.apache.ibatis.annotations.*;

@Mapper
public interface LoginMapper {
    @Select("select count(*) from user_admin where user_name=#{username} and user_password=#{password}")
    boolean checkUserExists(@Param("username") String username,@Param("password") String password);
    @Select("select count(*) from user where open_id=#{openid}")
    boolean searchOpenid(@Param("openid") String openid);
    @Insert("insert into user (open_id,user_url,user_wxname) values (#{openid},#{userDto.url},#{userDto.wxname})")
    void insertUser(@Param("openid") String openid, @Param("userDto") UserDto userDto);
    @Update("update user set user_url = #{userDto.url}, user_wxname = #{userDto.wxname} where open_id = #{openid}")
    void updateUser(@Param("openid") String openid, @Param("userDto") UserDto userDto);

}
